package com.harveyguo.nihonngo.model.entity;

import com.harveyguo.nihonngo.enums.EventLevel;
import jakarta.persistence.*;
import lombok.Data;

import java.util.Date;
import java.util.List;

/**
 * 赛事实体
 */
@Entity
@Data
@Table(name = "events")
public class Event extends BaseUserEntity {

    private String name; // 赛事名称

    private String description; // 赛事描述

    @Enumerated(EnumType.STRING)
    private EventLevel level; // 赛事级别

    private Date startDate; // 开始日期

    private Date endDate; // 结束日期

    private String location; // 举办地点

    private Double latitude; // 纬度

    private Double longitude; // 经度

    private String organizer; // 主办方

    private String contactInfo; // 联系信息

    private String registrationDeadline; // 报名截止日期

    private Integer maxParticipants; // 最大参与人数

    private Integer currentParticipants; // 当前参与人数

    private String entryFee; // 报名费

    private String prizes; // 奖品设置，JSON格式

    private String rules; // 比赛规则

    private String categories; // 比赛类别，JSON格式

    private String images; // 赛事图片，JSON格式

    private Boolean isActive = true; // 是否活跃

    private String status; // 状态：报名中、进行中、已结束

    // 关联的拳馆
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "gym_id")
    private BoxingGym boxingGym;

    // 参与者
    @ManyToMany(fetch = FetchType.LAZY)
    @JoinTable(name = "event_participants", joinColumns = @JoinColumn(name = "event_id"), inverseJoinColumns = @JoinColumn(name = "user_id"))
    private List<User> participants;

    // 裁判
    @ManyToMany(fetch = FetchType.LAZY)
    @JoinTable(name = "event_referees", joinColumns = @JoinColumn(name = "event_id"), inverseJoinColumns = @JoinColumn(name = "user_id"))
    private List<User> referees;
}